package com.kehongborui.spring.service;

import com.kehongborui.spring.dao.UserDao;
import com.kehongborui.spring.entity.User;

/**
 * @author zhang peng yang ming
 * @CopyRight (C) http://www.csdn.com
 * @brief
 * @email 122162005@qq.com
 * @date 2018-07-30
 */
public class LoginService {
    private UserDao userDao;

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }
    
    public User login(String username, String password) {
        User user = userDao.findByName(username);
        if (user != null && password.equals(user.getPassword())) {
            return user;
        }
        return null;
    }
}
